package com.moter.demo01.io.in_outputstream.bytearraystream;

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class ByteArrayOutputStreamDemo {
    public static void main(String[] args) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byteArrayOutputStream.write(new byte[]{'m','o','t','e','r'});
        System.out.println(byteArrayOutputStream.toString());
        byteArrayOutputStream.writeTo(new FileOutputStream("E:\\myCode\\JUC\\src\\main\\java\\com\\moter\\demo01\\io\\123.txt"));
        byteArrayOutputStream.reset();
        byteArrayOutputStream.write('a');
        System.out.println(byteArrayOutputStream.toString());
        byteArrayOutputStream.close();
    }
}
